home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 22 / AACD 22.iso / AACD / Programming / RxMUI / Examples / select.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2001-05-24  |  4.8 KB  |  157 lines

  1. /* */
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. call Init
  7. call CreateApp
  8. call set("mwin","open",1)
  9. call HandleApp
  10.  
  11. /***********************************************************************/
  12. init: procedure
  13.     l="rmh.library";if ~show("L",l) then;if ~AddLib(l,0,-30) then exit
  14.     if AddLibrary("rxmui.library")~=0 then exit
  15.     call RxMUIOpt("DebugMode ShowErr")
  16.     call SetRxMUIStack(64000)
  17.     return
  18. /***********************************************************************/
  19. CreateApp: procedure
  20.  
  21.     app.Title="Listview example"
  22.     app.Version="$VER: Listview examples 1.0 (5.12.2000)"
  23.     app.Copyright="©2000, alfie"
  24.     app.Author="alfie"
  25.     app.Description="Listview example"
  26.     app.Base="RXMUIEXAMPLE"
  27.     app.SubWindow="mwin"
  28.  
  29.      mwin.Title="Listview example"
  30.      mwin.ScreenTitle="Listview example"
  31.      mwin.ID="MWIN"
  32.      mwin.Contents="mgroup"
  33.  
  34.       mgroup.0="bg"
  35.        bg.class="group"
  36.        bg.Columns=3
  37.        bg.SameSize=1
  38.  
  39.         bg.0  = Button("selall","Select _All")
  40.         bg.1  = Button("selnone","Select _None")
  41.         bg.2  = Button("seltoggle","Select _Toggle")
  42.  
  43.         bg.3  = Button("remact","Remove Acti_ve")
  44.         bg.4  = Button("remall","Remove A_ll")
  45.         bg.5  = Button("remsel","Remove Selecte_d")
  46.  
  47.         bg.6  = Button("getactive","Get act_ive")
  48.         bg.7  = Button("getall","Get _all")
  49.         bg.8  = Button("getsel","Get Sele_cted")
  50.  
  51.         bg.9  = Button("sort","_Sort")
  52.         bg.10 = Button("readd","Add _Entryes")
  53.         bg.11 = ToggleButton("showsecret","S_how Secret")
  54.  
  55.       mgroup.1="lg"
  56.        lg.class="group"
  57.         lg.0="lview"
  58.          lview.Class="nlistview"
  59.          lview.List="list"
  60.          list.Title="First|Second|Third"
  61.           list.Format="BAR,"
  62.           list.Columns=3
  63.           list.TitleClick=2
  64.           list.MultiSelect="shifted"
  65.           list.DragSortable=1
  66.           list.DragType="immediate"
  67.           list.MincoLSortable=0
  68.           list.TitleMark=0
  69.  
  70.     res=NewObj("application","app")
  71.     if res~=0 then exit
  72.  
  73.     call notify("selall","pressed",0,"list","select","all","on")
  74.     call notify("selnone","pressed",0,"list","select","all","off")
  75.     call notify("seltoggle","pressed",0,"list","select","all","toggle")
  76.  
  77.     call notify("remall","pressed",0,"list","clear")
  78.     call notify("remact","pressed",0,"list","remove","active")
  79.     call notify("remsel","pressed",0,"list","remove","selected")
  80.  
  81.     call notify("getactive","pressed",0,"app","return","call GetActive")
  82.     call notify("getall","pressed",0,"app","return","call GetAll")
  83.     call notify("getsel","pressed",0,"app","return","call GetSel")
  84.  
  85.     call notify("readd","pressed",0,"app","return","call AddEntries")
  86.     call Notify("sort","pressed",0,"list","sort")
  87.     call Notify("showsecret","Selected",0,"list","set","format","BAR,")
  88.     call Notify("showsecret","Selected",1,"list","set","format","BAR,BAR,")
  89.  
  90.     call Notify("list","titleclick","everytime","list","sort2","triggervalue","add2values")
  91.     call Notify("list","sorttype","everytime","list","set","titlemark","triggervalue")
  92.  
  93.     call Notify("mwin","closerequest",1,"app","returnid","quit")
  94.  
  95.     call AddEntries
  96.  
  97.     return
  98. /***********************************************************************/
  99. HandleApp: procedure
  100.     ctrl_c=2**12
  101.     do forever
  102.         call NewHandle("app","h",ctrl_c)
  103.         if and(h.Signals,2**12)~=0 then exit
  104.         select
  105.             when h.Event="QUIT" then exit
  106.             otherwise interpret h.Event
  107.         end
  108.     end
  109. end
  110. /***********************************************************************/
  111. AddEntries: procedure
  112.  
  113.     call DoMethod("list","insert","Alfonso|Ranieri|Secret 1","bottom")
  114.     call DoMethod("list","insert","Emi|Ranieri|Secret 2","bottom")
  115.     call DoMethod("list","insert","Paolo|Ranieri|Secret 3","bottom")
  116.     call DoMethod("list","insert","Tiziana|Spognardi|Secret 4","bottom")
  117.     return
  118. /***********************************************************************/
  119. GetActive: procedure
  120.  
  121.     a=xget("list","active")
  122.     if a>-1 then do
  123.         call DoMethod("list","GetEntry",a,"e")
  124.         say "Active ["a"]:" e
  125.     end
  126.     else say "No entry active"
  127.     say
  128.     return
  129. /***********************************************************************/
  130. GetAll: procedure
  131.  
  132.     call DoMethod("list","GetEntries","A")
  133.     if a.num>0 then
  134.         do i=0 to a.num-1
  135.             say i":" a.i
  136.         end
  137.     else say "No entries"
  138.     say
  139.     return
  140. /***********************************************************************/
  141. GetSel: procedure
  142.  
  143.     call DoMethod("list","GetSelected","a")
  144.     if a.num>0 then
  145.         do i=0 to a.num-1
  146.             call DoMethod("list","GetEntry",i,"e")
  147.             say i":" e
  148.         end
  149.     else say "No entries"
  150.     say
  151.     return
  152. /***********************************************************************/
  153. halt:
  154. break_c:
  155.     exit
  156. /***********************************************************************/
  157.